<html>
<body>
    <div>
        <input id="addButton" type="button" value="添加"  >
    </div>
    <div id="container"></div>
    
    <script>
        var g = function(v){
            return document.getElementById(v)
        }
        var but = g("addButton");
        
        but.onclick =  function (){
            var pEle = document.createElement("p");
            var inputEle = document.createElement("input");
            inputEle.type = "text";
            var aEle = document.createElement("a");
            
            aEle.onclick = function(){
                var p = this.parentNode;
                var c = p.parentNode;
                c.removeChild(p);
            }
            
            aEle.innerHTML = "删除";
            
            pEle.appendChild(inputEle);
            pEle.appendChild(aEle);
            
            g("container").appendChild(pEle);
        }
        
    </script>
</body>
</html>